<?php
/**
 * User: Marko Ambrožič
 * Date: 13.12.2014
 * Time: 18:28
 */

class Zend_View_Helper_Messages {
    // Init data for AdminEdit form
    public function messages($namespace = 'Store_Admin') {
        $adminSession = new Zend_Session_Namespace($namespace);
        $html = '';
        if ($adminSession->error) {
            $html .= '<div class="error"><p>'.$adminSession->error.'</p></div>';
            $adminSession->error = null;
        }
        if ($adminSession->success) {
            $html .= '<div class="success"><p>'.$adminSession->success.'</p></div>';
            $adminSession->success = null;
        }
        return $html;
    }

    public function formatMessage($content, $type) {
        switch ($type) {
            case 'error':
                return '<div class="error"><p>'.$content.'</p></div>';
                break;
            case 'success':
                return '<div class="success"><p>'.$content.'</p></div>';
                break;
        }
    }
}